Optimal. Leaf size=106 \[ -\frac {a^2 c (c+i d) x}{(c-i d) d^2}+\frac {a^2 (c+2 i d) x}{d^2}+\frac {a^2 \log (\cos (e+f x))}{d f}-\frac {a^2 (i c-d) \log (c \cos (e+f x)+d \sin (e+f x))}{d (i c+d) f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.09, antiderivative size = 106, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3622, 3556,
3565, 3611} \begin {gather*} -\frac {a^2 c x (c+i d)}{d^2 (c-i d)}+\frac {a^2 x (c+2 i d)}{d^2}-\frac {a^2 (-d+i c) \log (c \cos (e+f x)+d \sin (e+f x))}{d f (d+i c)}+\frac {a^2 \log (\cos (e+f x))}{d f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3565
Rule 3611
Rule 3622
Rubi steps
\begin {align*} \int \frac {(a+i a \tan (e+f x))^2}{c+d \tan (e+f x)} \, dx &=\frac {a^2 (c+2 i d) x}{d^2}-\frac {a^2 \int \tan (e+f x) \, dx}{d}+\frac {(-i a c+a d)^2 \int \frac {1}{c+d \tan (e+f x)} \, dx}{d^2}\\ &=-\frac {a^2 c (c+i d) x}{(c-i d) d^2}+\frac {a^2 (c+2 i d) x}{d^2}+\frac {a^2 \log (\cos (e+f x))}{d f}+\frac {(-i a c+a d)^2 \int \frac {d-c \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{d \left (c^2+d^2\right )}\\ &=-\frac {a^2 c (c+i d) x}{(c-i d) d^2}+\frac {a^2 (c+2 i d) x}{d^2}+\frac {a^2 \log (\cos (e+f x))}{d f}-\frac {a^2 (i c-d) \log (c \cos (e+f x)+d \sin (e+f x))}{d (i c+d) f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 1.81, size = 176, normalized size = 1.66 \begin {gather*} \frac {a^2 \left (8 d f x+2 (-i c+d) \text {ArcTan}\left (\frac {d \cos (3 e+f x)-c \sin (3 e+f x)}{c \cos (3 e+f x)+d \sin (3 e+f x)}\right )+(-2 i c-2 d) \text {ArcTan}(\tan (3 e+f x))+c \log \left (\cos ^2(e+f x)\right )-i d \log \left (\cos ^2(e+f x)\right )-c \log \left ((c \cos (e+f x)+d \sin (e+f x))^2\right )-i d \log \left ((c \cos (e+f x)+d \sin (e+f x))^2\right )\right )}{2 (c-i d) d f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.21, size = 95, normalized size = 0.90
method | result | size |
norman | \(\frac {2 a^{2} x}{-i d +c}+\frac {i a^{2} \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{f \left (-i d +c \right )}-\frac {\left (i a^{2} d +a^{2} c \right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{d f \left (-i d +c \right )}\) | \(84\) |
derivativedivides | \(\frac {a^{2} \left (\frac {\left (-2 i c d -c^{2}+d^{2}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right ) d}+\frac {\frac {\left (2 i c -2 d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (2 i d +2 c \right ) \arctan \left (\tan \left (f x +e \right )\right )}{c^{2}+d^{2}}\right )}{f}\) | \(95\) |
default | \(\frac {a^{2} \left (\frac {\left (-2 i c d -c^{2}+d^{2}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right ) d}+\frac {\frac {\left (2 i c -2 d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (2 i d +2 c \right ) \arctan \left (\tan \left (f x +e \right )\right )}{c^{2}+d^{2}}\right )}{f}\) | \(95\) |
risch | \(-\frac {2 a^{2} x}{i d -c}-\frac {2 i a^{2} x}{d}-\frac {2 i a^{2} e}{d f}+\frac {2 a^{2} e}{f \left (i d -c \right )}-\frac {2 i a^{2} c x}{d \left (i d -c \right )}-\frac {2 i a^{2} c e}{d f \left (i d -c \right )}+\frac {a^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}{d f}+\frac {i a^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right )}{f \left (i d -c \right )}+\frac {a^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) c}{d f \left (i d -c \right )}\) | \(225\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.49, size = 117, normalized size = 1.10 \begin {gather*} \frac {\frac {2 \, {\left (a^{2} c + i \, a^{2} d\right )} {\left (f x + e\right )}}{c^{2} + d^{2}} - \frac {{\left (a^{2} c^{2} + 2 i \, a^{2} c d - a^{2} d^{2}\right )} \log \left (d \tan \left (f x + e\right ) + c\right )}{c^{2} d + d^{3}} - \frac {{\left (-i \, a^{2} c + a^{2} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{2} + d^{2}}}{f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.04, size = 86, normalized size = 0.81 \begin {gather*} \frac {{\left (-i \, a^{2} c + a^{2} d\right )} \log \left (\frac {{\left (i \, c + d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + i \, c - d}{i \, c + d}\right ) + {\left (i \, a^{2} c + a^{2} d\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )}{{\left (i \, c d + d^{2}\right )} f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 4.22, size = 92, normalized size = 0.87 \begin {gather*} \frac {a^{2} \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{d f} - \frac {a^{2} \left (c + i d\right ) \log {\left (e^{2 i f x} + \frac {\left (a^{2} c + i a^{2} d + \frac {i a^{2} d \left (c + i d\right )}{c - i d}\right ) e^{- 2 i e}}{a^{2} c} \right )}}{d f \left (c - i d\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.54, size = 127, normalized size = 1.20 \begin {gather*} \frac {\frac {a^{2} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1\right )}{d} + \frac {4 i \, a^{2} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + i\right )}{c - i \, d} + \frac {a^{2} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1\right )}{d} - \frac {{\left (a^{2} c + i \, a^{2} d\right )} \log \left (c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 2 \, d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - c\right )}{c d - i \, d^{2}}}{f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 5.75, size = 64, normalized size = 0.60 \begin {gather*} \frac {a^2\,\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,2{}\mathrm {i}}{f\,\left (c-d\,1{}\mathrm {i}\right )}-\frac {a^2\,\ln \left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (c+d\,1{}\mathrm {i}\right )}{d\,f\,\left (c-d\,1{}\mathrm {i}\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________